<template>
	<view class="premium-products-frame">
		<titleVue title="精品优选" enTitle='CURATED PICKS'></titleVue>

		<view class="content-frame">
			<view class="content-item" v-for="(item, index) in datalist" :key="index" @click="ToDetail(item)">
				<view class="image-frame">
					<image src="/static/test/test_1.png" class="image" mode=""></image>
					<image src="/static/icon/icon_heart_active.png" class="icon-heart" style="z-index: 2;" :style="{
								transform: `scale(${item.isHeart? '1': '0'})`
							}" @click="heartFn(item)" mode=""></image>
					<image src="/static/icon/icon_heart.png" class="icon-heart" mode="" @click="heartFn(item)"></image>
				</view>
				<view class="title">
					天然和田玉珠子挂件
				</view>
				<view class="price">
					￥18,400
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import titleVue from '../../../components/title/title.vue';
	export default {
		components: {
			titleVue
		},
		data() {
			return {
				datalist: [{
						isHeart: true
					},
					{
						isHeart: false
					},
					{
						isHeart: false
					},
					{
						isHeart: false
					},
					{
						isHeart: false
					},
					{
						isHeart: false
					},
				]
			}
		},
		onLoad() {

		},
		methods: {
			heartFn(data) {
				console.log(data)
				data.isHeart = !data.isHeart
			},
			ToDetail(item) {
				uni.navigateTo({
					url: `/pages/DetailPages/DetailPages`
				})
			}

		}
	}
</script>

<style lang="scss" scoped>
	.premium-products-frame {
		padding: 30rpx;
		background-color: #fff;
		font-size: 13px;
	}

	.content-frame {
		padding: 30rpx 0;
		display: grid;
		grid-template-columns: repeat(2, 1fr);
		gap: 30rpx;

		.content-item {
			font-size: 16px;

			.image-frame {
				width: 330rpx;
				height: 330rpx;
				border-radius: 8px;
				overflow: hidden;
				position: relative;

				.image {
					width: 100%;
					height: 100%;
				}

				.icon-heart {
					position: absolute;
					transition: all .3s;
					bottom: 30rpx;
					right: 30rpx;
					width: 25px;
					height: 25px;
				}
			}

			.title {
				font-size: $title;
				padding-top: 5px;
			}

			.price {
				padding-top: 5px;
				color: #deaf5c;
			}
		}
	}
</style>